

class Animal{
    public String sex;
    public int age;
    public String name;

    public void eat(){
        System.out.println(this.name+"::eat");
    }

    public void sleep(){
        System.out.println(this.name+"::sleep");
    }
}

class Cat extends Animal{

    public void miao(){
        System.out.println("miao miao~~~");
    }
}

class Dog extends Animal{

    public void Wang(){
        System.out.println("Wang Wang~~~");
    }
}
public class Inheritance {
    public static void main(String[] args) {

    }





    public class Base {
        int a;
        int b;
    }
    public class Derived extends Base{
        int c;
        public void method(){
            a = 10; // 访问从父类中继承下来的a
            b = 20; // 访问从父类中继承下来的b
            c = 30; // 访问子类自己的c
        }
    }}
